package hk3;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;


public class InputStreamReaderTest1 {
	//201521123003
	public static void main(String[] args) throws Exception{
		BufferedReader br=null;
		try {
			String fis ="d:/EncodeTest.txt";
			br=new BufferedReader(new FileReader(new File(fis)));
			
			String line = null;
			while((line=br.readLine())!=null)
				System.out.println(line);
		} finally{
			if (br!=null){
				br.close();
			}
		}
	}
	
	//201521123003
	public void convertGBK2UTF8(String src, String dst) throws IOException{
		BufferedReader br = null;
		OutputStreamWriter ost=null;
		try {
			br=new BufferedReader(new FileReader(src));
			String line=null;
			 ost=new OutputStreamWriter(new FileOutputStream(dst),"UTF-8");
			ost.write(line+"\n");
		} finally{
			br.close();
			ost.close();
		}
	}
}
